package com.biao.java8.lambda_test;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;

public class LambdaDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("333");
        list.add("222");
        list.add("111");
        /*
        lambda写法遍历集合
         */
        list.forEach(s -> System.out.println(s));
        // 简写
//        list.forEach(System.out::println);


        /*
        lambda写法集合排序
         */
        list.sort(Comparator.comparing(s -> {
            return s;
        }));
        list.forEach(System.out::println);

        /*
        lambda写法实现线程调用
         */
        new Thread(() -> System.out.println("线程名称：" + Thread.currentThread().getName())).start();

    }
}
